package com.lwx.pattern;

import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class PatternMain {
    public static void main(String[] args) {
        Pattern p =  Pattern.compile("<key>(.*?)</key><string>(.*?)</string>");
        Matcher m = p.matcher("<key>levelname</key><string>等级：</string><key>level1</key><string>菜鸟一枚</string>");
        
        while(m.find()){
            System.out.println(m.group(0));
            System.out.println(m.group(1));
            System.out.println(m.group(2));
        }
    }

}
